if (CMAKE_HOST_WIN32)

	SET(LIBEVENT_DIR ${THIRD_PARTY}/windows/x86/libevent)
	if(CMAKE_SIZEOF_VOID_P EQUAL 8)
		SET(LIBEVENT_DIR ${THIRD_PARTY}/windows/x64/libevent)
	endif()

	SET(LIBEVENT_INCLUDE_DIR ${LIBEVENT_DIR}/include)
	SET(LIBEVENT_LIB_DIR  ${LIBEVENT_DIR}/lib)
	SET(LIBEVENT_LIBS libcrypto libssl)
ELSE()

	IF(CMAKE_TOOLCHAIN_FILE)
		IF (CMAKE_SYSTEM_NAME STREQUAL Android)

			IF (ANDROID_ABI STREQUAL armeabi-v7a)
				SET(LIBEVENT_DIR ${THIRD_PARTY}/android/libevent/armeabi-v7a)
			ELSEIF (ANDROID_ABI STREQUAL arm64-v8a)
				SET(LIBEVENT_DIR ${THIRD_PARTY}/android/libevent/arm64-v8a)
			ENDIF()

			SET(LIBEVENT_INCLUDE_DIR ${LIBEVENT_DIR}/include)
			SET(LIBEVENT_LIB_DIR ${LIBEVENT_DIR}/lib)

		ELSEIF (CMAKE_C_COMPILER MATCHES "hisiv300")
			SET(LIBEVENT_DIR ${THIRD_PARTY}/hisiv300/libevent)
			SET(LIBEVENT_INCLUDE_DIR ${LIBEVENT_DIR}/include)
			SET(LIBEVENT_LIB_DIR ${LIBEVENT_DIR}/lib)
		ENDIF()

		IF (CMAKE_C_COMPILER MATCHES "hisiv400")
			SET(LIBEVENT_DIR ${THIRD_PARTY}/hisiv400/libevent)
			SET(LIBEVENT_INCLUDE_DIR ${LIBEVENT_DIR}/include)
			SET(LIBEVENT_LIB_DIR ${LIBEVENT_DIR}/lib)
		ENDIF()

		IF (CMAKE_C_COMPILER MATCHES "hisiv500")
			SET(LIBEVENT_DIR ${THIRD_PARTY}/hisiv500/libevent)
			SET(LIBEVENT_INCLUDE_DIR ${LIBEVENT_DIR}/include)
			SET(LIBEVENT_LIB_DIR ${LIBEVENT_DIR}/lib)
		ENDIF()

		IF (CMAKE_C_COMPILER MATCHES "hisiv600")
			SET(LIBEVENT_DIR ${THIRD_PARTY}/hisiv600/libevent)
			SET(LIBEVENT_INCLUDE_DIR ${LIBEVENT_DIR}/include)
			SET(LIBEVENT_LIB_DIR ${LIBEVENT_DIR}/lib)
		ENDIF()

		IF (CMAKE_C_COMPILER MATCHES "himix100")
			SET(LIBEVENT_DIR ${THIRD_PARTY}/himix100/libevent)
			SET(LIBEVENT_INCLUDE_DIR ${LIBEVENT_DIR}/include)
			SET(LIBEVENT_LIB_DIR ${LIBEVENT_DIR}/lib)
		ENDIF()

		IF (CMAKE_C_COMPILER MATCHES "himix200")
			SET(LIBEVENT_DIR ${THIRD_PARTY}/himix200/libevent)
			SET(LIBEVENT_INCLUDE_DIR ${LIBEVENT_DIR}/include)
			SET(LIBEVENT_LIB_DIR ${LIBEVENT_DIR}/lib)
		ENDIF()

	ELSE()
		FIND_PATH(LIBEVENT_INCLUDE_DIR NAMES event.h PATHS ${THIRD_PARTY}/gcc/libevent/include)
		FIND_PATH(LIBEVENT_LIB_DIR NAMES libevent.a PATHS ${THIRD_PARTY}/gcc/libevent/lib)
	ENDIF()	
	SET(LIBEVENT_LIBS ${LIBEVENT_LIB_DIR}/libevent.a)
ENDIF()
